home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-03 | 68.0 KB | 2,348 lines | [TEXT/MPS ] |
- //----------------------------------------------------------------------------------------
- // UApplication.cp
- // Copyright © 1984-96 by Apple Computer, Inc. All rights reserved.
- //----------------------------------------------------------------------------------------
-
- #ifndef __UAPPLICATION__
- #include "UApplication.h"
- #endif
-
- // MacApp
-
- #ifndef __UBEHAVIOR__
- #include "UBehavior.h"
- #endif
-
- #ifndef __UBUSYCURSOR__
- #include "UBusyCursor.h"
- #endif
-
- #ifndef __UCLIPBOARDMGR__
- #include "UClipboardMgr.h"
- #endif
-
- #if qContainer
- #ifndef __UCONTAINER__
- #include "UContainer.h"
- #endif
- #endif
-
- #ifndef __UDEBUG__
- #include "UDebug.h"
- #endif
-
- #if qDebug
- #ifndef __UDEBUGVIEW__
- #include "UDebugView.h"
- #endif
- #endif
-
- #ifndef __UDEPENDENCIES__
- #include "UDependencies.h"
- #endif
-
- #ifndef __UDESIGNATOR__
- #include "UDesignator.h"
- #endif
-
- #ifndef __UDOCUMENT__
- #include "UDocument.h"
- #endif
-
- #ifndef __UERRORMGR__
- #include "UErrorMgr.h"
- #endif
-
- #ifndef __UFILE__
- #include "UFile.h"
- #endif
-
- #ifndef __FLOATWINDOW__
- #include "FloatWindow.h"
- #endif
-
- #ifndef __UGEOMETRY__
- #include "UGeometry.h"
- #endif
-
- #ifndef __UMACAPPGLOBALS__
- #include "UMacAppGlobals.h"
- #endif
-
- #ifndef __UMACAPPUTILITIES__
- #include "UMacAppUtilities.h"
- #endif
-
- #if qPowerTalk
- #ifndef __UMAILABLE__
- #include "UMailable.h"
- #endif
- #endif
-
- #ifndef __UMEMORY__
- #include "UMemory.h"
- #endif
-
- #ifndef __UMENUMGR__
- #include "UMenuMgr.h"
- #endif
-
- #ifndef __UPATCH__
- #include "UPatch.h"
- #endif
-
- #ifndef __UPERFORM__
- #include "UPerform.h"
- #endif
-
- #ifndef __UPRINTHANDLER__
- #include "UPrintHandler.h"
- #endif
-
- #ifndef __UOSASCRIPT__
- #include "UOSAScript.h"
- #endif
-
- #ifndef __USCRIPTING__
- #include "UScripting.h"
- #endif
-
- #ifndef __USECTIONMGR__
- #include "USectionMgr.h"
- #endif
-
- #ifndef __USEGMENTS__
- #include "USegments.h"
- #endif
-
- #ifndef __USTREAM__
- #include "UStream.h"
- #endif
-
- #ifndef __UTABBEHAVIORS__
- #include "UTabBehaviors.h"
- #endif
-
- #ifndef __UVIEWSERVER__
- #include "UViewServer.h"
- #endif
-
- #if qNeedsVU
- #ifndef __UVUASSIST__
- #include "UVUAssist.h"
- #endif
- #endif
-
- #ifndef __UWINDOW__
- #include "UWindow.h"
- #endif
-
- // CALib
-
- #if qContainer
- #ifndef _CALIB_
- #include "CALib.h"
- #endif
- #endif
-
- // Toolbox
-
- #ifndef __AEREGISTRY__
- #include <AERegistry.h>
- #endif
-
- #ifndef __DEVICES__
- #include <Devices.h>
- #endif
-
- #ifndef __DISKINIT__
- #include <DiskInit.h>
- #endif
-
- #ifndef __ERRORS__
- #include <Errors.h>
- #endif
-
- #ifndef __LOWMEM__
- #include <LowMem.h>
- #endif
-
- #ifndef __RESOURCES__
- #include <Resources.h>
- #endif
-
- #ifndef __TOOLUTILS__
- #include <ToolUtils.h>
- #endif
-
- // ANSI
-
- #ifndef __STDIO__
- #include <stdio.h>
- #endif
-
- // Other
-
- #if defined(__MWERKS__) && (qDebug || qTheDebugger)
- #ifndef __CWDEBUG__
- #include "CWDebug.h"
- #endif
- #endif
-
- //----------------------------------------------------------------------------------------
- // Constant definitions
- //----------------------------------------------------------------------------------------
-
- enum SystemJustification { smSysJustLeft = 0, smSysJustRight = -1 };
- // Constants to use with GetSysDirection() and SetSysDirection().
-
-
- //----------------------------------------------------------------------------------------
- // Global variable definitions.
- //----------------------------------------------------------------------------------------
-
- TApplication* gApplication;
- //Boolean gInitialized;
- //AEAddressDesc gServerAddress;
-
-
- Boolean hadCreditsStringList; // does the rsrc 'STR#' == kDefaultCredits exist ?
- short lastCreditsStringIndex; // the last CString in the STR# to be displayed
- long lastCreditsShownTicks; // the tickcount when the last Credit was Shown
- CStringHandle originalText; // the about box's original text (prior to credits)
- short waitTicks; // how long to wait between credits
-
- //========================================================================================
- // GLOBAL Procedures
- //========================================================================================
- static pascal Boolean DoShowAboutAppFilter(DialogRef theDialog,
- EventRecord& theEvent,
- short& itemHit);
- static void DoSetupTheMenus(void* yourDataPtr);
-
- static WindowRef GetWindowToClose();
-
- #undef Inherited
-
- //----------------------------------------------------------------------------------------
- // DoShowAboutAppFilter:
- //----------------------------------------------------------------------------------------
- #pragma segment MAAboutApp
-
- pascal Boolean DoShowAboutAppFilter(DialogRef theDialog,
- EventRecord& theEvent,
- short& itemHit)
- {
- CStr255 s;
- CStr255 originalStr;
- Handle item;
- Boolean returnValue = FALSE;
- short itemType;
- CRect box;
-
- switch (theEvent.what)
- {
- case keyDown:
- switch ((unsigned char)(((theEvent.message) & charCodeMask)))
- {
- case chEnter:
- case chReturn:
- DoAlertKeyDown(theDialog, ok);
- break;
- }
- break;
-
- case nullEvent:
- if ((TickCount() - lastCreditsShownTicks) > waitTicks)
- {
- short itemNo = 1;
-
- do
- {
- item = NULL;
- GetDialogItem(theDialog, itemNo, &itemType, &item, box);
- if (((itemType) & 0x7F) == statText)// we don't care if its enabled or not
- break;
- else
- ++itemNo;
- } while (item);
-
- GetIndString(s, kDefaultCredits, lastCreditsStringIndex);
-
- if (!s.IsEmpty())
- {
- // save the original text
- if ((lastCreditsStringIndex == 1) && ((*originalText)->IsEmpty() && item))
- {
- GetDialogItemText(item, originalStr);
- SetString((StringHandle)originalText, (ConstStr255Param)&originalStr);
- }
- ++lastCreditsStringIndex;
- lastCreditsShownTicks = TickCount();
- if (item)
- SetDialogItemText(item, s);
- waitTicks = (short)Min((s.Length() * 6), 60);
- }
- else // no more items
- {
- lastCreditsStringIndex = 1;
- lastCreditsShownTicks = TickCount();
- if (item)
- {
- originalStr = **originalText;
- SetDialogItemText(item, originalStr);
- }
- waitTicks = 6 * 60;
- }
- }
- break;
- } // switch
-
- // Forward on to the standard filter
- if (gMacAppAlertFilter)
- returnValue = ((ModalFilterProcPtr)gMacAppAlertFilter)(theDialog, &theEvent, &itemHit);
-
- return returnValue;
- } // DoShowAboutAppFilter
-
- //========================================================================================
- // CLASS TQuitCommand
- //========================================================================================
- #undef Inherited
- #define Inherited TCommand
-
- #pragma segment MAApplicationRes
- MA_DEFINE_CLASS_M1(TQuitCommand, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TQuitCommand: Empty constructor to satisfy the compiler.
- //----------------------------------------------------------------------------------------
- #pragma segment ConstructorRes
-
- TQuitCommand::TQuitCommand()
- : fRespondingToAE(FALSE),
- fInProcessP(NULL),
- fMessage(NULL),
- fReply(NULL)
- {
- } // TQuitCommand::TQuitCommand
-
- //----------------------------------------------------------------------------------------
- // TQuitCommand destructor
- //----------------------------------------------------------------------------------------
- #pragma segment MADestructorRes
-
- TQuitCommand::~TQuitCommand()
- {
- if (fInProcessP != NULL)
- *fInProcessP = FALSE;
- }
-
- //----------------------------------------------------------------------------------------
- // TQuitCommand::IQuitCommand:
- //----------------------------------------------------------------------------------------
- #pragma segment MASelCommand
-
- void TQuitCommand::IQuitCommand(CommandNumber itsCommandNumber, Boolean* statusP)
- {
- this->ICommand(itsCommandNumber, gApplication, kCantUndo,
- kDoesNotCauseChange, NULL);
-
- fPriority++; // Lower our priority.
- fInProcessP = statusP;
- if (fInProcessP != NULL)
- *fInProcessP = TRUE;
- }
-
- //----------------------------------------------------------------------------------------
- // TQuitCommand::IQuitCommand:
- //----------------------------------------------------------------------------------------
- #pragma segment MASelCommand
-
- void TQuitCommand::IQuitCommand(TAppleEvent* message ,
- TAppleEvent* reply,
- Boolean* statusP)
- {
- this->ICommand(cQuit, gApplication, kCantUndo,
- kDoesNotCauseChange, NULL);
-
- fMessage = message;
- fReply = reply;
- fPriority++; // Lower our priority.
- fInProcessP = statusP;
- if (fInProcessP != NULL)
- *fInProcessP = TRUE;
-
- fRespondingToAE = TRUE;
- }
-
- //----------------------------------------------------------------------------------------
- // TQuitCommand::IsReadyToExecute:
- //----------------------------------------------------------------------------------------
- #pragma segment MAApplicationRes
-
- Boolean TQuitCommand::IsReadyToExecute() // Override
- {
- // Don't execute Quit if application has a dialog posed modally!
- if (gApplication->InModalState())
- return FALSE;
- else
- return fReadyToExecute;
- }
-
- //----------------------------------------------------------------------------------------
- // TQuitCommand::DoIt:
- //----------------------------------------------------------------------------------------
- #pragma segment MAApplicationRes
-
- void TQuitCommand::DoIt()
- {
- FailInfo fi;
- Try(fi)
- {
- // Close all windows and documents in window order then close
- // all documentless windows. Finally, shut down the application.
- DoCloseInWindowOrder();
- DoCloseWindowlessDocuments();
- DoCloseApplication();
-
- fi.Success();
- }
- else
- {
- if (fRespondingToAE)
- fi.ReSignal();
- else if (fi.error != userCanceledErr)
- gApplication->ShowError(fi.error, 0);
- }
- } // TQuitCommand::DoIt
-
- //----------------------------------------------------------------------------------------
- // GetWindowToClose:
- //----------------------------------------------------------------------------------------
- #pragma segment MAUtilitiesRes
-
- WindowRef GetWindowToClose()
- {
- WindowRef currentWindow = (WindowRef)LMGetWindowList();
- Boolean found = FALSE;
- while (currentWindow && !found)
- {
- if (currentWindow != gWorkPort)
- {
- TWindow* aWindow = gApplication->WMgrToWindow(currentWindow);
- if (aWindow)
- found = aWindow->fFreeOnClosing || aWindow->IsShown();
- else
- found = TRUE;
- }
- if (!found)
- currentWindow = GetNextWindow(currentWindow);
- }
- return currentWindow;
- }
-
- //----------------------------------------------------------------------------------------
- // TQuitCommand::DoCloseInWindowOrder:
- //----------------------------------------------------------------------------------------
- #pragma segment MAApplicationRes
-
- void TQuitCommand::DoCloseInWindowOrder()
- {
- // This will iterate through all open windows and will close the associated
- // document if there is one or will close the window if there is no document.
- // (Ghost documents are not closed here. But their windows are.)
- WindowRef aWindowPtr;
- while ((aWindowPtr = GetWindowToClose()) != NULL)
- {
- TWindow* aWindow = gApplication->WMgrToWindow(aWindowPtr);
- if (aWindow)
- {
- TDocument* windowsDocument = aWindow->fDocument;
- if (windowsDocument != NULL && !windowsDocument->GetIsGhostDocument())
- CloseADocument(windowsDocument);
- else
- CloseAWindow(aWindow);
- }
- else
- gApplication->CloseToolboxWindow(aWindowPtr);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // TQuitCommand::DoCloseWindowlessDocuments:
- //----------------------------------------------------------------------------------------
- #pragma segment MAApplicationRes
-
- void TQuitCommand::DoCloseWindowlessDocuments()
- {
- // This really doesn't care if the document is windowless or not, it's
- // just that all documents with windows should have been closed by now.
- CNoGhostDocsIterator iter(gApplication);
-
- for (TDocument* aDocument = iter.FirstDocument();
- iter.More(); aDocument = iter.NextDocument())
- {
- // Closing the document will close any associated windows.
- MAVolatileInit(TCloseDocCommand*, aCloseCommand, NULL);
- MAVolatileInit(Boolean, oldTempAlloc, TemporaryAllocation(TRUE));
- MAVolatileInit(Boolean, oldObjectPerm, AllocateObjectsFromPerm(FALSE));
-
- FailInfo fi;
- Try(fi)
- {
- aCloseCommand = aDocument->MakeCloseCommand();
- if (fRespondingToAE)
- aCloseCommand->fUseAppleEvent = FALSE;
- aCloseCommand->Process();
-
- TemporaryAllocation(oldTempAlloc);
- AllocateObjectsFromPerm(oldObjectPerm);
-
- fi.Success();
- }
- else // Recover
- {
- TemporaryAllocation(oldTempAlloc);
- AllocateObjectsFromPerm(oldObjectPerm);
- fi.ReSignal();
- }
- }
- }
-
- //----------------------------------------------------------------------------------------
- // TQuitCommand::CloseAWindow:
- //----------------------------------------------------------------------------------------
- #pragma segment MAApplicationRes
-
- void TQuitCommand::CloseAWindow(TWindow* aWindow)
- {
- Boolean record = !fRespondingToAE
- && (gClipboardMgr->fClipWindow != aWindow)
- && aWindow->IsShown();
- MAVolatileInit(TCloseWindowCommand*, aCloseWindowCommand, NULL);
- MAVolatileInit(Boolean, oldTempAlloc, TemporaryAllocation(TRUE));
- MAVolatileInit(Boolean, oldObjectPerm, AllocateObjectsFromPerm(FALSE));
-
- FailInfo fi;
- Try(fi)
- {
- aCloseWindowCommand = new TCloseWindowCommand;
- aCloseWindowCommand->ICloseWindowCommand(cClose, aWindow);
- if (!record)
- aCloseWindowCommand->fUseAppleEvent = FALSE;
- aCloseWindowCommand->Process();
-
- TemporaryAllocation(oldTempAlloc);
- AllocateObjectsFromPerm(oldObjectPerm);
-
- fi.Success();
- }
- else // Recover
- {
- TemporaryAllocation(oldTempAlloc);
- AllocateObjectsFromPerm(oldObjectPerm);
-
- fi.ReSignal();
- }
- }
-
- //----------------------------------------------------------------------------------------
- // TQuitCommand::DoCloseDocuments:
- //----------------------------------------------------------------------------------------
- #pragma segment MAApplicationRes
-
- void TQuitCommand::CloseADocument(TDocument* aDocument)
- {
- // Closing the document will close any associated windows.
- MAVolatileInit(TCloseDocCommand*, aCloseCommand, NULL);
- MAVolatileInit(Boolean, oldTempAlloc, TemporaryAllocation(TRUE));
- MAVolatileInit(Boolean, oldObjectPerm, AllocateObjectsFromPerm(FALSE));
-
- FailInfo fi;
- Try(fi)
- {
- aCloseCommand = aDocument->MakeCloseCommand();
- if (fRespondingToAE)
- aCloseCommand->fUseAppleEvent = FALSE;
- aCloseCommand->Process();
-
- TemporaryAllocation(oldTempAlloc);
- AllocateObjectsFromPerm(oldObjectPerm);
-
- fi.Success();
- }
- else // Recover
- {
- TemporaryAllocation(oldTempAlloc);
- AllocateObjectsFromPerm(oldObjectPerm);
-
- fi.ReSignal();
- }
- }
-
- //----------------------------------------------------------------------------------------
- // TQuitCommand::DoCloseApplication:
- //----------------------------------------------------------------------------------------
- #pragma segment MAApplicationRes
-
- void TQuitCommand::DoCloseApplication()
- {
- // Final Stage: We're ready to do the final shutdown now that
- // all windows and documents have been closed.
- Boolean oldTempAlloc = TemporaryAllocation(TRUE);
- Boolean oldObjectPerm = AllocateObjectsFromPerm(FALSE);
-
- TQuitAppCommand* aQuitAppCommand = new TQuitAppCommand;
- aQuitAppCommand->IQuitAppCommand(cQuit);
- if (fRespondingToAE)
- aQuitAppCommand->fUseAppleEvent = FALSE;
- aQuitAppCommand->Process();
-
- TemporaryAllocation(oldTempAlloc);
- AllocateObjectsFromPerm(oldObjectPerm);
- }
-
- //========================================================================================
- // CLASS TQuitAppCommand
- //========================================================================================
- #undef Inherited
- #define Inherited TCommand
-
- #pragma segment MAApplicationRes
- MA_DEFINE_CLASS_M1(TQuitAppCommand, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TQuitAppCommand constructor
- //----------------------------------------------------------------------------------------
- #pragma segment ConstructorRes
-
- TQuitAppCommand::TQuitAppCommand()
- {
- } // TQuitAppCommand::TQuitAppCommand
-
- //----------------------------------------------------------------------------------------
- // TQuitAppCommand destructor
- //----------------------------------------------------------------------------------------
- #pragma segment MADestructorRes
-
- TQuitAppCommand::~TQuitAppCommand()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // TQuitAppCommand::IQuitAppCommand:
- //----------------------------------------------------------------------------------------
- #pragma segment MASelCommand
-
- void TQuitAppCommand::IQuitAppCommand(CommandNumber itsCommandNumber)
- {
- this->ICommand(itsCommandNumber, gApplication, kCantUndo, kDoesNotCauseChange, NULL);
- }
-
- //----------------------------------------------------------------------------------------
- // TQuitAppCommand::MakeAppleEvent:
- //----------------------------------------------------------------------------------------
- #pragma segment MAApplicationRes
-
- TAppleEvent* TQuitAppCommand::MakeAppleEvent()
- {
- MAVolatileInit(TAppleEvent*, mayFailEvent, NULL);
-
- FailInfo fi;
- Try(fi)
- {
- CAEDesc mySpecifier;
- TAppleEvent* theEvent = new TAppleEvent;
- theEvent->IAppleEvent(kCoreEventClass, kAEQuitApplication, gServerAddress, kAEWaitReply);
- mayFailEvent = theEvent;
- gApplication->MakeObjectSpecifier(mySpecifier, formName);
- theEvent->WriteParameter(keyDirectObject, mySpecifier);
- fi.Success();
- }
- else // Recover
- {
- mayFailEvent = (TAppleEvent*)FreeIfObject(mayFailEvent);
- fi.ReSignal();
- }
-
- return mayFailEvent;
- }
-
- //----------------------------------------------------------------------------------------
- // TQuitAppCommand::IsReadyToExecute:
- //----------------------------------------------------------------------------------------
- #pragma segment MAApplicationRes
-
- Boolean TQuitAppCommand::IsReadyToExecute() // Override
- {
- // Don't execute Quit if application has a dialog posed modally!
- if (gApplication->InModalState())
- return FALSE;
- else
- return fReadyToExecute;
- }
-
- //----------------------------------------------------------------------------------------
- // TQuitAppCommand::DoIt:
- //----------------------------------------------------------------------------------------
- #pragma segment MAApplicationRes
-
- void TQuitAppCommand::DoIt()
- {
- FailInfo fi;
- Try(fi)
- {
- gApplication->fDone = TRUE;
- gApplication->Close();
- fi.Success();
- }
- else // Recover
- {
- gApplication->fDone = FALSE;
- fi.ReSignal();
- }
- } // TQuitAppCommand::DoIt
-
- //========================================================================================
- // CLASS TNewDocumentCommand
- //========================================================================================
- #undef Inherited
- #define Inherited TCommand
-
- #pragma segment MAOpen
- MA_DEFINE_CLASS_M1(TNewDocumentCommand, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TNewDocumentCommand: Empty constructor to satisfy the compiler.
- //----------------------------------------------------------------------------------------
- #pragma segment ConstructorRes
-
- TNewDocumentCommand::TNewDocumentCommand()
- {
- } // TNewDocumentCommand::TNewDocumentCommand
-
- //----------------------------------------------------------------------------------------
- // TNewDocumentCommand destructor
- //----------------------------------------------------------------------------------------
- #pragma segment MADestructorRes
-
- TNewDocumentCommand::~TNewDocumentCommand()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // TNewDocumentCommand::DoIt:
- //----------------------------------------------------------------------------------------
- #pragma segment MAOpen
-
- void TNewDocumentCommand::DoIt()
- {
- gApplication->OpenNew(fIdentifier);
- } // TNewDocumentCommand::DoIt
-
- //----------------------------------------------------------------------------------------
- // TNewDocumentCommand::INewDocumentCommand:
- //----------------------------------------------------------------------------------------
- #pragma segment MASelCommand
-
- void TNewDocumentCommand::INewDocumentCommand(CommandNumber itsCommandNumber)
- {
- this->ICommand(itsCommandNumber, gApplication, kCantUndo, kDoesNotCauseChange, NULL);
- } // TNewDocumentCommand::INewDocumentCommand
-
- //----------------------------------------------------------------------------------------
- // TNewDocumentCommand::MakeAppleEvent:
- //----------------------------------------------------------------------------------------
- #pragma segment MACommandRes
-
- TAppleEvent* TNewDocumentCommand::MakeAppleEvent()
- {
- // Create a recordable apple event
- TAppleEvent * theEvent = NULL;
- CTempDesc theAppDesc;
-
- gApplication->MakeObjectSpecifier(theAppDesc);
-
- theEvent = TAppleEvent::MakeCreateElementEvent(gServerAddress, kAEWaitReply,
- theAppDesc, cDocument, kAEBeginning, CAEDesc::fgNullDesc, CAEDesc::fgNullDesc);
- return theEvent;
- }
-
- //========================================================================================
- // CLASS TFilesCommand
- //========================================================================================
- #undef Inherited
- #define Inherited TServerCommand
-
- #pragma segment MASelCommand
- MA_DEFINE_CLASS_M1(TFilesCommand, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TFilesCommand constructor
- //----------------------------------------------------------------------------------------
- #pragma segment MASelCommand
-
- TFilesCommand::TFilesCommand()
- {
- fCausesChange = FALSE;
- fFileList = NULL;
- #if qPowerTalk
- fOpenLetters = FALSE;
- #endif
- } // TFilesCommand::TFilesCommand
-
- //----------------------------------------------------------------------------------------
- // TFilesCommand::Free:
- //----------------------------------------------------------------------------------------
- #pragma segment MAClose
-
- TFilesCommand::~TFilesCommand()
- {
- fFileList = (TList*)FreeListIfObject(fFileList);
- } // TFilesCommand::Free
-
-
- //----------------------------------------------------------------------------------------
- // TFilesCommand::IFilesCommand:
- //----------------------------------------------------------------------------------------
- #pragma segment MASelCommand
-
- void TFilesCommand::IFilesCommand(CommandNumber itsCommandNumber,
- TList* theDocuments)
- {
- this->IServerCommand(itsCommandNumber, gApplication, kCantUndo, kDoesNotCauseChange, NULL);
- fFileList = theDocuments;
- } // TFilesCommand::IFilesCommand
-
- //----------------------------------------------------------------------------------------
- // TFilesCommand::IFilesCommand:
- //----------------------------------------------------------------------------------------
- #pragma segment MASelCommand
-
- void TFilesCommand::IFilesCommand(CommandNumber itsCommandNumber,
- const AppleEvent& itsMessage,
- const AppleEvent& itsReply) // override
- {
- IServerCommand(itsCommandNumber, gApplication, kCantUndo, kDoesNotCauseChange, NULL,
- itsMessage, itsReply);
-
- // Check to see what is in the direct object list
- this->GetFilesList();
- } // TFilesCommand::IFilesCommand
-
- //----------------------------------------------------------------------------------------
- // TFilesCommand::GetFilesList:
- //----------------------------------------------------------------------------------------
- #pragma segment MASelCommand
-
- void TFilesCommand::GetFilesList()
- {
- // Check to see what is in the direct object list
- CAEDesc directObj;
- FailOSErr(AEGetParamDesc(&fMessage->fMessage, keyDirectObject, typeAEList, directObj));
- long theCount = 0;
- FailOSErr(AECountItems(directObj, &theCount));
- if (theCount > 0)
- {
- // Get the first descriptor and see what type it is
- DescType theKey;
- CTempDesc theDesc;
- FailOSErr(AEGetNthDesc(directObj, 1, typeWildCard, &theKey, theDesc));
- #if qPowerTalk
- // ••• should notify user that powertalk is not available
- fOpenLetters = (theDesc.GetDescriptorType() == typeLetterDesc);
- #endif
- }
-
- #if qPowerTalk
- if (fOpenLetters)
- {
- fIdentifier = cOpenLetter;
- fLetterList = directObj;
- }
- else
- #endif
- {
- MAVolatileInit(THandleList*, aHandleList, NULL);
- MAVolatileInit(TList*, aFileList, NULL);
-
- FailInfo outerFi;
- Try(outerFi)
- {
- aHandleList = new THandleList;
- aHandleList->IHandleList();
-
- FailInfo innerfi;
- Try(innerfi)
- {
- aFileList = NewList();
-
- fMessage->ReadHandleList(keyDirectObject, typeAlias, aHandleList);
-
- // Block is necessary for correct failure handling
- {
- CHandleIterator iter(aHandleList);
-
- for (Handle item = iter.FirstHandle(); iter.More(); item = iter.NextHandle())
- {
- MAVolatileInit(TFile*, aFile, NULL);
-
- aFile = gApplication->DoMakeFile(fIdentifier);
-
- FailInfo onemorefi;
- Try(onemorefi)
- {
- FailOSErr(aFile->SpecifyWithAlias(AliasHandle(item)));
- aFileList->InsertLast(aFile);
- onemorefi.Success();
- }
- else
- {
- aFile = (TFile*)FreeIfObject(aFile);
- onemorefi.ReSignal();
- }
-
- aHandleList->Delete(item); // Delete it from the list so if we fail
- // we don't try to free it twice
- item = DisposeIfHandle(item);
- }
- }
- innerfi.Success();
- }
- else // Recover
- {
- if (aHandleList)
- aHandleList->FreeList();
-
- if (aFileList)
- aFileList->FreeList();
-
- innerfi.ReSignal();
- }
- outerFi.Success();
- }
- else
- {
- this->Free();
- outerFi.ReSignal();
- }
-
- aHandleList->Free(); // It is just a list of disposed handles…
-
- fFileList = aFileList;
- directObj.DisposeDesc();
- }
-
- } // TFilesCommand::IFilesCommand
-
- //========================================================================================
- // CLASS TODocCommand
- //========================================================================================
- #undef Inherited
- #define Inherited TFilesCommand
-
- #pragma segment MASelCommand
- MA_DEFINE_CLASS_M1(TODocCommand, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TODocCommand: Empty constructor to satisfy the compiler.
- //----------------------------------------------------------------------------------------
- #pragma segment ConstructorRes
-
- TODocCommand::TODocCommand()
- {
- } // TODocCommand::TODocCommand
-
- //----------------------------------------------------------------------------------------
- // TODocCommand destructor
- //----------------------------------------------------------------------------------------
- #pragma segment MADestructorRes
-
- TODocCommand::~TODocCommand()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // TODocCommand::IODocCommand:
- //----------------------------------------------------------------------------------------
- #pragma segment MASelCommand
-
- void TODocCommand::IODocCommand(CommandNumber itsCommandNumber,
- TList* theDocuments)
- {
- this->IFilesCommand(itsCommandNumber, theDocuments);
- } // TODocCommand::IODocCommand
-
- //----------------------------------------------------------------------------------------
- // TODocCommand::IODocCommand:
- //----------------------------------------------------------------------------------------
- #pragma segment MASelCommand
-
- void TODocCommand::IODocCommand(CommandNumber itsCommandNumber,
- const AppleEvent& itsMessage,
- const AppleEvent& itsReply)
- {
- this->IFilesCommand(itsCommandNumber, itsMessage, itsReply);
- } // TODocCommand::IODocCommand
-
- //----------------------------------------------------------------------------------------
- // TODocCommand::DoIt:
- //----------------------------------------------------------------------------------------
- #pragma segment MAOpen
-
- void TODocCommand::DoIt() // override
- {
- FailInfo fi;
- // Try(fi)
- // {
- #if qPowerTalk
- if (fOpenLetters && HasAOCEToolBox())
- {
- if (gMailing)
- gMailing->OpenOldLetters(fIdentifier, fLetterList);
- }
- else
- #endif
- gApplication->OpenOld(fIdentifier, fFileList);
-
- // fi.Success();
- // }
- // else
- // {
- // this->SetValidationError(fi.error);
- // fi.ReSignal();
- // }
- } // TODocCommand::DoIt
-
- //----------------------------------------------------------------------------------------
- // TODocCommand::MakeAppleEvent:
- //----------------------------------------------------------------------------------------
- #pragma segment MACommandRes
-
- TAppleEvent* TODocCommand::MakeAppleEvent()
- {
- MAVolatileInit(TAppleEvent*, mayFailEvent, NULL);
- CTempDesc theList;
-
- FailInfo fi;
- Try(fi)
- {
- TAppleEvent* theEvent = new TAppleEvent;
- theEvent->IAppleEvent(kCoreEventClass, kAEOpenDocuments, gServerAddress, kAEWaitReply);
- mayFailEvent = theEvent;
- theList.CreateList();
- {
- CObjectIterator iter(fFileList);
- for (TFile * aFile = (TFile *)iter.FirstObject(); iter.More(); aFile = (TFile *)iter.NextObject())
- {
- AliasHandle theAlias = NULL;
- OSErr theErr = aFile->GetAlias(theAlias);
- if (theErr == noErr)
- {
- CAEDesc theAliasDesc(typeAlias, (Handle)theAlias);
- theList.PutListItem(0, theAliasDesc);
- }
- }
- }
- theEvent->WriteParameter(keyDirectObject, theList);
- fi.Success();
- }
- else // Recover
- {
- mayFailEvent = (TAppleEvent *)FreeIfObject(mayFailEvent);
- fi.ReSignal();
- }
- return mayFailEvent;
- }
-
- //========================================================================================
- // CLASS TPDocCommand
- //========================================================================================
- #undef Inherited
- #define Inherited TFilesCommand
-
- #pragma segment MASelCommand
- MA_DEFINE_CLASS_M1(TPDocCommand, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TPDocCommand constructor
- //----------------------------------------------------------------------------------------
- #pragma segment MASelCommand
-
- TPDocCommand::TPDocCommand()
- {
- fRequiresUserInteraction = TRUE;
- fTargetPrinter.name[0] = 0; // no target printer
- } // TPDocCommand::TPDocCommand
-
- //----------------------------------------------------------------------------------------
- // TPDocCommand destructor
- //----------------------------------------------------------------------------------------
- #pragma segment MADestructorRes
-
- TPDocCommand::~TPDocCommand()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // TPDocCommand::IPDocCommand:
- //----------------------------------------------------------------------------------------
- #pragma segment MASelCommand
-
- void TPDocCommand::IPDocCommand(CommandNumber itsCommandNumber,
- TList* theDocuments)
- {
- this->IFilesCommand(itsCommandNumber, theDocuments);
- } // TPDocCommand::IPDocCommand
-
- //----------------------------------------------------------------------------------------
- // TPDocCommand::IPDocCommand:
- //----------------------------------------------------------------------------------------
- #pragma segment MASelCommand
-
- void TPDocCommand::IPDocCommand(CommandNumber itsCommandNumber,
- const AppleEvent& itsMessage,
- const AppleEvent& itsReply)
- {
- Boolean draggedToDTP = FALSE; // this will let us support cDragPrint
-
- AEDescList dtpList;
- OSErr err = AEGetAttributeDesc(&itsMessage, keyOptionalKeywordAttr, typeAEList, &dtpList);
- if (err == noErr)
- {
- draggedToDTP = TRUE;
-
- AEKeyword theKeyword;
- DescType typeCode;
- Size actualSize;
-
- OSErr err = AEGetNthPtr(&dtpList, 1, typeFSS, &theKeyword, &typeCode, (Ptr)&fTargetPrinter, sizeof(FSSpec), &actualSize);
- AEDisposeDesc(&dtpList);
- }
-
- this->IFilesCommand(draggedToDTP ? cDragPrint : itsCommandNumber, itsMessage, itsReply);
- } // TPDocCommand::IPDocCommand
-
- //----------------------------------------------------------------------------------------
- // TPDocCommand::DoIt:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFinder
-
- void TPDocCommand::DoIt() // override
- {
- gApplication->PrintDocuments(fIdentifier, fFileList, fTargetPrinter.name[0] ? &fTargetPrinter : NULL);
- } // TPDocCommand::DoIt
-
-
- //========================================================================================
- // CLASS TAboutBoxCommand
- //========================================================================================
- #undef Inherited
- #define Inherited TCommand
-
- #pragma segment MASelCommand
- MA_DEFINE_CLASS_M1(TAboutBoxCommand, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TAboutBoxCommand: Empty constructor to satisfy the compiler.
- //----------------------------------------------------------------------------------------
- #pragma segment ConstructorRes
-
- TAboutBoxCommand::TAboutBoxCommand()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // TAboutBoxCommand destructor
- //----------------------------------------------------------------------------------------
- #pragma segment MADestructorRes
-
- TAboutBoxCommand::~TAboutBoxCommand()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // TAboutBoxCommand::IAboutBoxCommand:
- //----------------------------------------------------------------------------------------
- #pragma segment MASelCommand
-
- void TAboutBoxCommand::IAboutBoxCommand(CommandNumber itsCommandNumber)
- {
- this->ICommand(itsCommandNumber, gApplication, kCantUndo, kDoesNotCauseChange, NULL);
- FailOSErr(MAInteractWithUser());
- } // TAboutBoxCommand::IAboutBoxCommand
-
- //----------------------------------------------------------------------------------------
- // TAboutBoxCommand::DoIt:
- //----------------------------------------------------------------------------------------
- #pragma segment MAAboutApp
-
- void TAboutBoxCommand::DoIt()
- {
- gApplication->DoAboutBox();
- } // TAboutBoxCommand::DoIt
-
-
- //========================================================================================
- // CLASS TEventRetrieverCommand
- //========================================================================================
-
- #if qNeedsVU
-
- //========================================================================================
- // CLASS TVUApplication
- //========================================================================================
- #undef Inherited
- #define Inherited TDispatcher
-
- #pragma segment MAInit
- MA_DEFINE_CLASS_M1(TVUApplication, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TVUApplication constructor
- //----------------------------------------------------------------------------------------
- #pragma segment MAInit
-
- TVUApplication::TVUApplication()
- {
- } // TVUApplication::TVUApplication
-
- //----------------------------------------------------------------------------------------
- // TVUApplication::IVUApplication:
- //----------------------------------------------------------------------------------------
- #pragma segment MAInit
-
- void TVUApplication::IVUApplication(OSType itsMainFileType,
- OSType itsCreator)
- {
- this->IDispatcher(itsMainFileType, itsCreator);
-
- FailInfo fi;
- Try(fi)
- {
- gVUAssist = new TVUAssist();
- gVUAssist->IVUAssist(gUGridViewInitialized);
- fi.Success();
- }
- else
- {
- #if qDebug
- ProgramBreak("Can't initialize the virtual user assist object!");
- #endif
- this->Free();
- gVUAssist = NULL;
- // we don't fail if we have no VU support
- // Don't ReSignal
- }
-
- } // TVUApplication::IVUApplication
-
-
- //----------------------------------------------------------------------------------------
- // TVUApplication::Free:
- //----------------------------------------------------------------------------------------
- #pragma segment MAClose
-
- TVUApplication::~TVUApplication()
- {
- gVUAssist = (TVUAssist*)FreeIfObject(gVUAssist);
- } // TVUApplication::Free
-
- //----------------------------------------------------------------------------------------
- // TVUApplication::AboutToLoseControl:
- //----------------------------------------------------------------------------------------
- #pragma segment MAActivate
-
- void TVUApplication::AboutToLoseControl(Boolean)
- {
- if (gVUAssist)
- gVUAssist->SuspendMole();
- } // TVUApplication::AboutToLoseControl
-
- //----------------------------------------------------------------------------------------
- // TVUApplication::RegainControl:
- //----------------------------------------------------------------------------------------
- #pragma segment MAApplicationRes
-
- void TVUApplication::RegainControl(Boolean)
- {
- if (gVUAssist)
- gVUAssist->ResumeMole();
- } // TVUApplication::RegainControl
-
- #endif
-
- //========================================================================================
- // CLASS TApplication
- //========================================================================================
- #undef Inherited
-
- #if qNeedsVU
- #define Inherited TVUApplication
- #else
- #define Inherited TDispatcher
- #endif
-
- #pragma segment MAInit
- MA_DEFINE_CLASS_M1(TApplication, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TApplication constructor
- //----------------------------------------------------------------------------------------
- #pragma segment MAInit
-
- TApplication::TApplication()
- {
- // This is a special case. It needs to be available as soon as possible.
- gApplication = this;
-
- fLaunchWithNewDocument = TRUE;
-
- #if qDebug
- fDebugFlagsWindow = NULL;
- #endif
- } // TApplication::TApplication
-
- //----------------------------------------------------------------------------------------
- // TApplication destructor
- //----------------------------------------------------------------------------------------
- #pragma segment MADestructorRes
-
- TApplication::~TApplication()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // TApplication::IApplication:
- //----------------------------------------------------------------------------------------
- #pragma segment MAInit
-
- void TApplication::IApplication(OSType itsMainFileType,
- OSType itsCreator)
- {
- #if qNeedsVU
- this->IVUApplication(itsMainFileType, itsCreator);
- #else
- this->IDispatcher(itsMainFileType, itsCreator);
- #endif
-
- FailInfo fi;
- Try(fi)
- {
- // Install the default tab behavior
- TMultiWindowTabber * aTabber = new TMultiWindowTabber;
- aTabber->IMultiWindowTabber(TRUE);
- this->AddBehavior(aTabber);
-
- {
- // Register views so we can create them from templates
- #if qDebug
- MA_REGISTER_CLASS(TDebugFlagsView);
- #endif
- }
-
- fi.Success();
- }
- else
- {
- #if qDebug
- ProgramBreak("Can't initialize the application object!");
- #endif
- this->Free();
- gApplication = NULL;
- fi.ReSignal();
- }
- } // TApplication::IApplication
-
- //----------------------------------------------------------------------------------------
- // TApplication::CanOpenDocument:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFinder
-
- // This is called only when opening/printing from the finder and from standard file;
- // it simulates the filtering done by Std File.
-
- Boolean TApplication::CanOpenDocument(CommandNumber itsCommandNumber,
- TFile* aFile)
- {
- Boolean returnValue = FALSE;
-
- ProcPtr fileFilter;
- TypeListHandle typeList = NULL;
- short dlgID;
- CPoint where;
- ProcPtr dlgHook;
- ProcPtr modalFilter;
- Ptr activeList;
- ProcPtr activateProc;
- void* yourDataPtr = NULL;
-
- this->GetStandardFileParameters(itsCommandNumber, fileFilter, typeList, dlgID, where,
- dlgHook, modalFilter, activeList, activateProc,
- NULL, yourDataPtr);
-
- CStr63 fileName;
- aFile->GetName(fileName);
-
- CInfoPBRec paramBlock;
-
- short numTypes = (short)(GetHandleSize((Handle)typeList) / sizeof(ResType));
- if (numTypes == 0)
- {
- if (!fileFilter)
- returnValue = TRUE; // no file filter then want all types
- else if (aFile->GetCatInfo(paramBlock) == noErr)
- {
- paramBlock.hFileInfo.ioNamePtr = (StringPtr)fileName;
- // Call through the supplied filterProc
- returnValue = !((FileFilterYDProcPtr)fileFilter)(¶mBlock, NULL);
- }
- else
- returnValue = FALSE;
- }
- else
- {
- for (short i = 0; i < numTypes; ++i)
- {
- if (((long)(aFile->fFileType)) == ((long)(*typeList)[i]))
- {
- if (!fileFilter)
- returnValue = TRUE;
- else if (aFile->GetCatInfo(paramBlock) == noErr)
- {
- paramBlock.hFileInfo.ioNamePtr = (StringPtr)fileName;
- // Call through the supplied filterProc
- returnValue = !((FileFilterYDProcPtr)fileFilter)(¶mBlock, NULL);
- }
- else
- returnValue = FALSE;
- break;
- }
- }
- }
-
- typeList = (TypeListHandle)DisposeIfHandle((Handle)typeList);
- return returnValue;
- } // TApplication::CanOpenDocument
-
- //----------------------------------------------------------------------------------------
- // TApplication::ChooseApplication:
- //----------------------------------------------------------------------------------------
- #pragma segment MAOpen
-
- Boolean TApplication::ChooseApplication(AEAddressDesc& theAddress)
- {
- // typedef TargetID* TargetIDPtr,
- // ** TargetIDHdl;
-
- TargetIDHdl theTargetID;
- LocationNameRec theLoc;
- PortInfoRec thePortInfo;
- OSErr theErr;
- CStr32 theLocNBPType;
- Boolean returnValue = FALSE;
-
- theErr = PPCBrowser(gEmptyString, gEmptyString, FALSE, &theLoc, &thePortInfo, NULL, gEmptyString);
- if (theErr == noErr)
- {
- theTargetID = (TargetIDHdl) NewPermHandle(sizeof(TargetID));
-
- (*theTargetID)->location = theLoc;
- (*theTargetID)->name = thePortInfo.name;
- theAddress.descriptorType = typeTargetID;
- theAddress.dataHandle = (Handle)theTargetID;
- returnValue = TRUE;
- }
- else if (theErr != userCanceledErr)
- FailOSErr(theErr);
- return returnValue;
- } // TApplication::ChooseApplication
-
- //----------------------------------------------------------------------------------------
- // TApplication::ChooseDocument:
- //----------------------------------------------------------------------------------------
- #pragma segment MAOpen
-
- Boolean TApplication::ChooseDocument(CommandNumber itsCommandNumber,
- TList** aFileList)
- {
- typedef SFTypeList* SFTypeListPtr;
- typedef SFTypeListPtr* SFTypeListHandle;
-
- MAVolatileInit(TFile*, aFile, NULL);
- Boolean fileChosen;
-
- #if !qPowerPC && !qModelCFM
- if (HasCustomFile())
- {
- #endif
- ProcPtr fileFilter;
- TypeListHandle typeList;
- short dlgID;
- CPoint where;
- ProcPtr dlgHook;
- ProcPtr modalFilter;
- Ptr activeList;
- ProcPtr activateProc;
- StandardFileReply customReply;
- void* yourDataPtr = NULL;
-
- this->GetStandardFileParameters(itsCommandNumber, fileFilter, typeList, dlgID, where,
- dlgHook, modalFilter, activeList, activateProc,
- &customReply, yourDataPtr);
-
- SFTypeListPtr pTypeList;
- short numTypes = (short)(GetHandleSize((Handle)typeList) / sizeof(ResType));
- if (numTypes == 0)
- {
- numTypes = -1; // Tell Std File to display all types.
- pTypeList = (SFTypeListPtr) & pTypeList;// arbitrary, as long as it points to 4 bytes of valid memory
- }
- else
- {
- LockHandleHigh((Handle)typeList); // in case Std File does allocations
- pTypeList = *((SFTypeListHandle)typeList);
- }
-
- // Causes TApplication::GetEvent to call CheckRsrcUsage.
- gRsrcCheck = 0;
-
- FailInfo fi;
- Try(fi)
- {
-
- aFile = this->DoMakeFile(itsCommandNumber);
- fileChosen = FALSE;
-
- FailOSErr(MAInteractWithUser());
-
- if (yourDataPtr == NULL)
- yourDataPtr = &itsCommandNumber;
-
- gClipboardMgr->AboutToLoseControl(TRUE); // so scrap gets converted
-
- FileFilterYDUPP cgfFileFilter = NewFileFilterYDProc(fileFilter);
- DlgHookYDUPP cgfDlgHook = NewDlgHookYDProc(dlgHook);
- ModalFilterYDUPP cgfModalFilter = NewModalFilterYDProc(modalFilter);
- ActivateYDUPP cgfActivateProc = NewActivateYDProc(activateProc);
-
- CustomGetFile(cgfFileFilter, numTypes, (*pTypeList), &customReply, dlgID, where, cgfDlgHook, cgfModalFilter, (short*)activeList, cgfActivateProc, yourDataPtr);
-
- cgfFileFilter = (FileFilterYDUPP)DisposeIfRoutineDescriptor((UniversalProcPtr)cgfFileFilter);
- cgfDlgHook = (DlgHookYDUPP)DisposeIfRoutineDescriptor((UniversalProcPtr)cgfDlgHook);
- cgfModalFilter = (ModalFilterYDUPP)DisposeIfRoutineDescriptor((UniversalProcPtr)cgfModalFilter);
- cgfActivateProc = (ActivateYDUPP)DisposeIfRoutineDescriptor((UniversalProcPtr)cgfActivateProc);
-
- gClipboardMgr->RegainControl(TRUE); // so scrap gets converted
-
- fileChosen = customReply.sfGood;
- if (fileChosen)
- aFile->SpecifyWithStandardFileReply(customReply);
-
- fi.Success();
- }
- else // Recover
- {
- typeList = (TypeListHandle)DisposeIfHandle((Handle)typeList);
- aFile = (TFile *)FreeIfObject(aFile);
- fi.ReSignal();
- }
-
- typeList = (TypeListHandle)DisposeIfHandle((Handle)typeList);
-
-
-
- #if !qPowerPC && !qModelCFM
- // the following block of code is the "else" block for the above Gestalt check -
- // as with that check, it is only relevant if we are not built for PowerPC
- }
- else
- {
- ProcPtr fileFilter;
- TypeListHandle typeList;
- short dlgID;
- CPoint where;
- ProcPtr dlgHook;
- ProcPtr modalFilter;
- Ptr activeList;
- ProcPtr activateProc;
- SFReply reply;
- void* yourDataPtr = NULL;
-
- // We can't pass reply because it's a lowly SFReply, not a StandardFileReply
- this->GetStandardFileParameters(itsCommandNumber, fileFilter, typeList, dlgID, where,
- dlgHook, modalFilter, activeList, activateProc,
- NULL, yourDataPtr);
-
- SFTypeListPtr pTypeList;
- short numTypes = (short)(GetHandleSize((Handle)typeList) / sizeof(ResType));
- if (numTypes == 0)
- {
- numTypes = -1; // Tell Std File to display all types.
- pTypeList = (SFTypeListPtr) & pTypeList;// arbitrary, as long as it points to 4 bytes of valid memory
- }
- else
- {
- LockHandleHigh((Handle)typeList); // in case Std File does allocations
- pTypeList = *((SFTypeListHandle)typeList);
- }
-
- // Causes TApplication::GetEvent to call CheckRsrcUsage.
- gRsrcCheck = 0;
-
- FailInfo fi;
- Try(fi)
- {
-
- aFile = this->DoMakeFile(itsCommandNumber);
- fileChosen = FALSE;
-
- FailOSErr(MAInteractWithUser());
-
- if (yourDataPtr == NULL)
- yourDataPtr = &itsCommandNumber;
-
- // We will pass the address of the CallBack instead of the modalFilter to
- // SFPGetFile It will add yourDataPtr parameter before passing on to the
- // ModalFilterProc supplied by SFPutParms this lets us assume a single calling
- // convention for that function.
-
- // Don't create a CallBack when the SF callback is NULL.
- // Also, pass itsCommandNumber as a default yourDataPtr.
-
- CallBack myFileFilterCallBack;
- SetCallBack(fileFilter, (long)yourDataPtr, &myFileFilterCallBack);
- FileFilterProcPtr aFileFilterProcPtr = fileFilter ? (FileFilterProcPtr)&myFileFilterCallBack : NULL;
-
- CallBack myModalHookCallBack;
- SetCallBack(dlgHook, (long)yourDataPtr, &myModalHookCallBack);
- DlgHookProcPtr aDlgHookProcPtr = dlgHook ? (DlgHookProcPtr)&myModalHookCallBack : NULL;
-
- CallBack myModalFilterCallBack;
- SetCallBack(modalFilter, (long)yourDataPtr, &myModalFilterCallBack);
- ModalFilterProcPtr aModalFilterProcPtr = modalFilter ? (ModalFilterProcPtr)&myModalFilterCallBack : NULL;
-
- gClipboardMgr->AboutToLoseControl(TRUE); // so scrap gets converted
-
- SFPGetFile(where, gEmptyString, aFileFilterProcPtr, numTypes, (*pTypeList), aDlgHookProcPtr, &reply, dlgID, aModalFilterProcPtr);
-
- gClipboardMgr->RegainControl(TRUE); // so scrap gets converted
-
- fileChosen = reply.good;
- if (fileChosen)
- FailOSErr(aFile->SpecifyWithSFReply(reply));
-
- fi.Success();
- }
- else // Recover
- {
- typeList = (TypeListHandle)DisposeIfHandle((Handle)typeList);
- aFile = (TFile *)FreeIfObject(aFile);
- fi.ReSignal();
- }
-
- typeList = (TypeListHandle)DisposeIfHandle((Handle)typeList);
-
- }
- #endif
-
- if (fileChosen)
- {
- MAVolatileInit(TList**, volatileFileList, aFileList);
-
- FailInfo fi;
- Try(fi)
- {
- // Return the file(s) chosen
- *volatileFileList = NewList();
- (*volatileFileList)->InsertLast(aFile);
- fi.Success();
- }
- else
- {
- if (*volatileFileList)
- *volatileFileList = (TList*)FreeIfObject(*volatileFileList);
- aFile = (TFile*)FreeIfObject(aFile);
- fi.ReSignal();
- }
- }
- else // user cancelled or something
- aFile = (TFile *)(FreeIfObject(aFile)); // free the unwanted file object
-
- return fileChosen;
- } // TApplication::ChooseDocument
-
- //----------------------------------------------------------------------------------------
- // TApplication::DoMakeDocument:
- //
- // E X A M P L E
- // {
- // TDocument* aYOURDocument = NULL;
- //
- // aYOURDocument = new TDocument;
- // aYOURDocument->IYOURDocument();
- // return aYOURDocument;
- // }
- //----------------------------------------------------------------------------------------
- #pragma segment MANever
-
- TDocument* TApplication::DoMakeDocument(CommandNumber, TFile*)
- {
- this->SubClassResponsibility();
- return NULL; // So that CFront doesn't complain
- } // TApplication::DoMakeDocument
-
- //----------------------------------------------------------------------------------------
- // TApplication::DoMenuCommand:
- //----------------------------------------------------------------------------------------
- #pragma segment MASelCommand
-
- void TApplication::DoMenuCommand(CommandNumber aCommandNumber)
- {
- // ===================================================================================
- // Some commands will be posted to perform actions that must _ALWAYS_ be available.
- // The allocation cannot be allowed to fail. So we do a temp allocation which by
- // definition cannot be allowed to fail. This strategy is used wherever we want to use
- // command objects but don't want to leave the user twisting in the breeze. NOTE:
- // Don't forget to allow for this memory in your mem! resource if you copy this style
- // in your own code.
- // ===================================================================================
-
- switch (aCommandNumber)
- {
- case cQuit:
- {
- Boolean oldTempAlloc = TemporaryAllocation(TRUE);
- Boolean oldObjectPerm = AllocateObjectsFromPerm(FALSE);
- TQuitCommand * aQuitCommand;
- aQuitCommand = new TQuitCommand;
- aQuitCommand->IQuitCommand(aCommandNumber);
- this->PostCommand(aQuitCommand);
- TemporaryAllocation(oldTempAlloc);
- AllocateObjectsFromPerm(oldObjectPerm);
- }
- break;
-
- case cNew: // cNew..cNewLast:
- case 11:
- case 12:
- case 13:
- case 14:
- case 15:
- case 16:
- case 17:
- case 18:
- case cNewLast:
- case cFinderNew:
- this->DoNew(aCommandNumber);
- break;
-
- case cOpen: // cOpen..cOpenLast:
- case 21:
- case 22:
- case 23:
- case 24:
- case 25:
- case 26:
- case 27:
- case 28:
- case cOpenLast:
- this->DoOpen(aCommandNumber);
- break;
-
- case cAboutApp:
- {
- TAboutBoxCommand * aAboutAppCommand = new TAboutBoxCommand;
- aAboutAppCommand->IAboutBoxCommand(aCommandNumber);
- this->PostCommand(aAboutAppCommand);
- }
- break;
-
- #if qDebug
- case cDebugFlags:
- {
- if (!fDebugFlagsWindow)
- FailNIL(fDebugFlagsWindow = gViewServer->NewTemplateWindow(kDebugFlagsView, NULL));
- fDebugFlagsWindow->Open();
- fDebugFlagsWindow->Select();
- }
- break;
-
- case cRefreshFrontWindow:
- {
- TWindow * aWindow = this->GetActiveWindow(kNoFloaters);
-
- if (aWindow)
- aWindow->ForceRedraw();
- }
- break;
-
- case cDoFirstClick:
- {
- TWindow * aWindow = this->GetActiveWindow(kNoFloaters);
-
- if (aWindow)
- aWindow->fDoFirstClick = !aWindow->fDoFirstClick;
- }
- break;
-
- // System Justification - see comment in Debug.r
- // case cSetSysJust:
- // swap the current setting
- // if (GetSysDirection() == smSysJustLeft)
- // SetSysDirection(smSysJustRight);
- // else
- // SetSysDirection(smSysJustLeft);
- // break;
- #endif
-
- #if qPerform
- case cPerfMonInit:
- {
- TWindow* aWindow;
- IDType dismisser;
-
- FailNIL(aWindow = gViewServer->NewTemplateWindow(kPerfMonInitView, NULL));
- dismisser = aWindow->PoseModally();
- if (dismisser == 'init')
- InitiatePerfMonitor(aWindow);
- aWindow->CloseAndFree();
- }
- break;
-
- case cPerfMonDump:
- {
- StandardFileReply replyRec;
- StandardPutFile((StringPtr)"\pSave as:", (StringPtr)"\puntitled", &replyRec);
- if (replyRec.sfGood)
- DumpPerfMonitor(replyRec.sfFile);
- }
- break;
-
- case cPerfMonToggle:
- EnablePerfMonitor(!PerfMonitorEnabled());
- break;
-
- case cPerfMonEnd:
- TerminatePerfMonitor();
- break;
- #endif
-
- default:
- Inherited::DoMenuCommand(aCommandNumber);
- break;
- }
- } // TApplication::DoMenuCommand
-
- //----------------------------------------------------------------------------------------
- // TApplication::DoSetupMenus:
- //----------------------------------------------------------------------------------------
- #pragma segment MAApplicationRes
-
- void TApplication::DoSetupMenus()
- {
- Inherited::DoSetupMenus();
-
- Boolean lowSpace = MemSpaceIsLow();
-
- Enable(cAboutApp, TRUE);
- Enable(-(mApple << 8), TRUE); // allow the whole menu
-
- Enable(cQuit, fEventLevel <= 1); // Can't enable Quit if in nested event handling
- Enable(cNew, !lowSpace);
- Enable(cOpen, !lowSpace);
-
- #if qDebug
- {
- TWindow* aWindow = gApplication->GetActiveWindow(kNoFloaters);
-
- Enable(cRefreshFrontWindow, (aWindow != NULL));
- Enable(cDoFirstClick, (aWindow != NULL));
- if (aWindow)
- SetMenuState(cDoFirstClick, kDebugBuzzStrings, bzDoFirstClick, bzDontDoFirstClick, aWindow->fDoFirstClick);
-
- Enable(cDebugFlags, TRUE);
-
- // System Justification - see comment in Debug.r
- // Enable(cSetSysJust, TRUE);
- // SetMenuState(cSetSysJust, kDebugBuzzStrings, bzSetRightSysJust, bzSetLeftSysJust, GetSysDirection() != smSysJustLeft);
- }
- #endif
-
- #if qPerform
- {
- Boolean initiated = PerfMonitorInitiated();
-
- Enable(cPerfMonInit, !initiated);
- Enable(cPerfMonDump, initiated);
- Enable(cPerfMonToggle, initiated);
- SetMenuState(cPerfMonToggle, kDebugBuzzStrings, bzContinuePerfMon, bzPausePerfMon, PerfMonitorEnabled());
- Enable(cPerfMonEnd, initiated);
- }
- #endif
-
- } // TApplication::DoSetupMenus
-
- //----------------------------------------------------------------------------------------
- // TApplication::DoAboutBox: Method to display the "About" box for your application.
- // Override to do interesting things. Since it is normally called from a command; the app
- // usually has the maximum free space available.
- //----------------------------------------------------------------------------------------
- #pragma segment MAAboutApp
-
- void TApplication::DoAboutBox()
- {
- FailSpaceIsLow();
- FailOSErr(MAInteractWithUser());
-
- CStr255 apName;
- this->GetApplicationName(apName);
-
- ParamText(apName, gEmptyString, gEmptyString, gEmptyString); // Put Application name in the about box
-
- if (GetResource('STR#', kDefaultCredits))
- {
- lastCreditsStringIndex = 1;
- lastCreditsShownTicks = TickCount();
- waitTicks = 5 * 60;
- originalText = (CStringHandle)NewString(gEmptyString);
- FailNIL(originalText);
- MacAppAlert(phAboutApp, (ProcPtr)DoShowAboutAppFilter);
- originalText = (CStringHandle)DisposeIfHandle((Handle)originalText);
- }
- else
- StdAlert(phAboutApp);
- } // TApplication::DoAboutBox
-
- //----------------------------------------------------------------------------------------
- // TApplication::HandleFinderRequest:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFinder
-
- void TApplication::HandleFinderRequest()
- {
- } // TApplication::HandleFinderRequest
-
- //----------------------------------------------------------------------------------------
- // TApplication::KindOfDocument:
- //----------------------------------------------------------------------------------------
- #pragma segment MAOpen
-
- CommandNumber TApplication::KindOfDocument(CommandNumber itsCommandNumber,
- TFile*)
- {
- return itsCommandNumber;
- } // TApplication::KindOfDocument
-
- //----------------------------------------------------------------------------------------
- // TApplication::OpenNew:
- //----------------------------------------------------------------------------------------
- #pragma segment MAOpen
-
- TDocument* TApplication::OpenNew(CommandNumber itsCommandNumber)
- {
- MAVolatileInit(TDocument*, aDocument, NULL);
-
- FailInfo fi;
- Try(fi)
- {
- FailNIL(aDocument = this->DoMakeDocument(this->KindOfDocument(itsCommandNumber, NULL), NULL));
- aDocument->DoInitialState();
-
- aDocument->DoMakeViews(kForDisplay);
-
- CStr255 newTitle;
- aDocument->UntitledName(newTitle);
- aDocument->SetTitle(newTitle);
-
- FailSpaceIsLow(); // Fail if document leaves us with no room
-
- // Don't attempt to show the windows until we're sure we won't fail
- aDocument->DoPostMakeViews(kForDisplay);
-
- fi.Success();
- }
- else // Recover
- {
- if (aDocument)
- aDocument = (TDocument *)(FreeIfObject(aDocument)); // The document will free the file
-
- FailNewMessage(fi.error, fi.message, messageNewFailed);
- }
- return aDocument;
- } // TApplication::OpenNew
-
- //----------------------------------------------------------------------------------------
- // TApplication::OpenOld:
- //----------------------------------------------------------------------------------------
- #pragma segment MAOpen
-
- TDocument* TApplication::OpenOld(CommandNumber itsOpenCommand, TList* aFileList)
- {
- MAVolatileInit(TDocument*, aDocument, NULL);
- MAVolatileInit(TFile*, aFile, NULL);
- MAVolatileInit(TFile*, aNewFile, NULL);
- MAVolatileInit(OSErr, savedError, 0);
- MAVolatileInit(long, savedMessage, 0);
-
- Size oldCodeReserve; // can't be volatile because it is passed by reference
- Size oldMemReserve; // can't be volatile because it is passed by reference
-
- {
- // Put iterator in a separate block so that it will go out of scope before the end of the method.
- // We don't want the iterator's failure handler to be invoked, because its stack ptr is munged.
- // If an error occurs, we'll just save it and ReSignal it after the iterator is gone.
-
- CObjectIterator iter(aFileList);
- for (aFile = (TFile *)iter.FirstObject(); iter.More() && !savedError; aFile = (TFile *)iter.NextObject())
- {
- CommandNumber kindOfDocCmd = this->KindOfDocument(itsOpenCommand, aFile);
- // reset aDocument and aNewFile so that they no longer refer to items from the
- // last go round (important in case we fail downstream)…
- aDocument = NULL;
- aNewFile = NULL;
-
- CStr63 fileName;
- aFile->GetName(fileName); // If failure occurs the file may already be
- // freed so we will save the name just in
- // case.
-
- aFileList->Delete(aFile); // ReadStationery if successful will dispose
- // of the file for us so if failure occurs
- // this had better not be in the file list.
-
- FailInfo fi;
- Try(fi)
- {
- // Set reserve down a little to ensure that we can open existing documents
- GetReserveSize(oldCodeReserve, oldMemReserve);
- SetReserveSize(oldCodeReserve, oldMemReserve / 2);
-
- TDocument * otherDoc = this->FindDocument(aFile);
- Boolean isStationery = aFile->IsStationery();
-
- if (otherDoc && !isStationery)
- {
- otherDoc->OpenAgain(kindOfDocCmd, aDocument);
- aFile = (TFile*)FreeIfObject(aFile);
- SetReserveSize(oldCodeReserve, oldMemReserve);
- }
- else if (this->CanOpenDocument(kindOfDocCmd, aFile))
- {
- TFile* fileOwnedByDoc = aFile;
- aFile = NULL;
- FailNIL(aDocument = this->DoMakeDocument(kindOfDocCmd, fileOwnedByDoc));
-
- if (!isStationery)
- aDocument->ReadDocument(kForDisplay);
- else
- {
- aNewFile = this->DoMakeFile(kindOfDocCmd);
- aDocument->ReadStationery(aNewFile);
- aFile = NULL; // This file has already been freed by ReadStationery.
- aNewFile = NULL; // Clear our reference so that if we fail
- // we don't try to free this file twice.
- }
-
- aDocument->DoMakeViews(kForDisplay);
-
- if (isStationery)
- {
- CStr255 newTitle;
- aDocument->UntitledName(newTitle);
- aDocument->SetTitle(newTitle);
- }
-
- FailSpaceIsLow(); // Fail if the document leaves us with no
- // memory
- // Set the reserve back to where it was
- SetReserveSize(oldCodeReserve, oldMemReserve);
-
- // Don't attempt to show the windows until we're sure we won't fail
- aDocument->DoPostMakeViews(kForDisplay);
- }
- else
- Failure(errNotMyType, 0);
- fi.Success();
- }
- else // Recover
- {
- if (fi.message == 0)
- gErrorParm3 = fileName;
-
- // We may have ended up without a document because of a failure during document
- // init. b/c this can be the case we don't know what happened to aFile, whether
- // it was freed by the document in the failure process or orphaned. Because of
- // this we will not free aFile here.
- if (aDocument)
- aDocument = (TDocument *)(FreeIfObject(aDocument)); // The document will free the file
-
- aNewFile = (TFile*)FreeIfObject(aNewFile); // If we successfully read the
- // stationery then aNewFile will be NULL
-
- // Set the reserve back to where it was
- SetReserveSize(oldCodeReserve, oldMemReserve);
-
- // Don't want to fail here, because the CObjectIterator (with its embedded FailInfo) is
- // still in scope. Instead, save the error info until after the iterator has self-destructed.
- // FailNewMessage(fi.error, fi.message, messageOpenFailed);
- savedError = fi.error;
- savedMessage = fi.message;
- if (!savedMessage)
- savedMessage = messageOpenFailed;
- }
- }
- } // iterator will self-destruct now
-
- if (savedError != noErr) // Do we need to ReSignal a failure?
- {
- // signal the failure
- Failure(savedError, savedMessage);
- }
- return aDocument;
- } // TApplication::OpenOld
-
- //----------------------------------------------------------------------------------------
- // TApplication::PrintDocuments:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFinder
-
- void TApplication::PrintDocuments(CommandNumber itsCommandNumber, TList* aFileList, const FSSpec* targetPrinter)
- {
- MAVolatileInit(TDocument*, aDocument, NULL);
- MAVolatileInit(TFile*, aFile, NULL);
-
- TPrintHandler::gFinderPrintingProceed = TRUE; // set in TStdPrintHandler::DoPrintCommand
- TPrintHandler::gPrintHandler->PrepareForFinderPrinting(targetPrinter);
-
- CObjectIterator iter(aFileList);
- for (aFile = (TFile *)iter.FirstObject(); iter.More(); aFile = (TFile *)iter.NextObject())
- {
- if (TPrintHandler::gFinderPrintingProceed)
- {
- FailInfo fi;
- Try(fi)
- {
- FailNIL(aDocument = this->DoMakeDocument(this->KindOfDocument(itsCommandNumber, aFile), aFile));
- aDocument->ReadDocument(kForPrinting);
- aDocument->DoMakeViews(kForPrinting);
- aDocument->DoPostMakeViews(kForPrinting);
-
- aDocument->HandleMenuCommand(itsCommandNumber);
-
- fi.Success();
- }
- else // Recover
- {
- if (aDocument)
- {
- // If there is a document then it will have a reference to aFile and
- // will free it when it is freed. Therefore we need to remove it from
- // the list so that when the file list is freed we don't attempt to
- // free it twice.
- aFileList->Delete(aFile);
- aDocument = (TDocument *)FreeIfObject(aDocument);
- }
- fi.ReSignal();
- }
- aFileList->Delete(aFile);
- aDocument = (TDocument *)FreeIfObject(aDocument);
- }
- else
- break; // The user canceled printing
- }
- } // TApplication::PrintDocuments
-
- //----------------------------------------------------------------------------------------
- // TApplication::GetStandardFileParameters:
- //----------------------------------------------------------------------------------------
- #pragma segment MAOpen
-
- void TApplication::GetStandardFileParameters(CommandNumber itsCommandNumber,
- ProcPtr& fileFilter,
- TypeListHandle& typeList,
- short& dlgID,
- CPoint& where,
- ProcPtr& dlgHook,
- ProcPtr& modalFilter,
- Ptr& activeList,
- ProcPtr& activateProc,
- StandardFileReply* /*reply*/,
- void*& yourDataPtr)
- {
- dlgID = sfGetDialogID;
- where = kBestSystemLocation;
-
- this->GetFileTypeList(itsCommandNumber, typeList);
-
- fileFilter = NULL;
- dlgHook = NULL;
- modalFilter = (ProcPtr)gModalFilterYDProcPtr;
- activeList = NULL;
- activateProc = NULL;
- yourDataPtr = NULL;
- } // TApplication::GetStandardFileParameters
-
- //----------------------------------------------------------------------------------------
- // TApplication::GetFileTypeList:
- //----------------------------------------------------------------------------------------
- #pragma segment MAOpen
-
- void TApplication::GetFileTypeList(CommandNumber,
- TypeListHandle& typeList)
- {
- typeList = (TypeListHandle) NewPermHandle(4);
- (*typeList)[0] = fMainFileType;
- } // TApplication::GetFileTypeList
-
- //----------------------------------------------------------------------------------------
- // TApplication::DoNew:
- //----------------------------------------------------------------------------------------
- #pragma segment MAScriptingRes
-
- void TApplication::DoNew(CommandNumber theCmdNumber)
- {
- TNewDocumentCommand *aNewDocCommand = new TNewDocumentCommand;
- aNewDocCommand->INewDocumentCommand(theCmdNumber);
- aNewDocCommand->fUseAppleEvent = TRUE;
- this->PostCommand(aNewDocCommand);
- }
-
- //----------------------------------------------------------------------------------------
- // TApplication::DoOpen:
- //----------------------------------------------------------------------------------------
- #pragma segment MAScriptingRes
-
- void TApplication::DoOpen(CommandNumber theCmdNumber)
- {
- TList* aFileList = NULL; // passed by address
-
- if (this->ChooseDocument(theCmdNumber, &aFileList))
- {
- TODocCommand * anODocCommand = new TODocCommand;
- anODocCommand->IODocCommand(theCmdNumber, aFileList);
- anODocCommand->fUseAppleEvent = TRUE;
- this->PostCommand(anODocCommand);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // TApplication::DoAECreateElement:
- //----------------------------------------------------------------------------------------
- #pragma segment MAScriptingRes
-
- void TApplication::DoAECreateElement(TAppleEvent* message,
- TAppleEvent* reply)
- {
- // Creates a new document. If your application has more than one type of document
- // you'll need to override this method. The default simulates choosing "New" from
- // the file menu.
- DescType theClass = message->ReadType(keyAEObjectClass);
- if (IsDocumentClass(theClass) || (theClass == cWindow))
- {
- if (CommandEnabled(cNew))
- {
- TDocument * theDoc = this->OpenNew(cNew);
- // Apply the properties if any.
- theDoc->SetPropertiesFromEvent(message);
-
- // Apply the initial data if any
- if (message->HasParameter(keyAEData))
- theDoc->DoAESetData(message, reply);
-
- // Return the document's object specifier
- CTempDesc theDocsSpecifier;
- theDoc->MakeObjectSpecifier(theDocsSpecifier, formName);
- if (reply->fMessage.dataHandle)
- reply->WriteParameter(keyAEResult, theDocsSpecifier);
- }
- }
- }
-
- //----------------------------------------------------------------------------------------
- // TApplication::DoAEClose:
- //----------------------------------------------------------------------------------------
- #pragma segment MAScriptingRes
-
- void TApplication::DoAEClose(TAppleEvent* message,
- TAppleEvent* reply)
- {
- if (CommandEnabled(cQuit))
- {
- Boolean oldTempAlloc = TemporaryAllocation(TRUE);
- Boolean oldObjectPerm = AllocateObjectsFromPerm(FALSE);
- TQuitCommand* quitCommand = NULL;
- Boolean quitIsBeingProcessed = TRUE;
-
- quitCommand = new TQuitCommand;
- quitCommand->IQuitCommand(message, reply, &quitIsBeingProcessed);
-
- quitCommand->Process();
-
- TemporaryAllocation(oldTempAlloc);
- AllocateObjectsFromPerm(oldObjectPerm);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // TApplication::DoScriptCommand:
- //----------------------------------------------------------------------------------------
- #pragma segment MAScriptingRes
-
- void TApplication::DoScriptCommand(CommandNumber aCommandNumber,
- TAppleEvent* message,
- TAppleEvent* reply)
- {
- TEventHandler * theTarget = this->GetTarget();
-
- switch (aCommandNumber)
- {
- case cFinderNew:
- // Special case the old MacPaint style open if user knows about the option
- // key. Only if the application is frontmost though.
- if (this->IsFrontProcess() && IsOptionKeyDown())
- this->HandleMenuCommand(cOpen);
- else if (fLaunchWithNewDocument)
- this->GetTarget()->HandleMenuCommand(cFinderNew);
- break;
-
- case cFinderOpen:
- {
- TODocCommand * anODocCommand = new TODocCommand;
- anODocCommand->IODocCommand(aCommandNumber, message->fMessage, reply->fMessage);
- this->PostCommand(anODocCommand);
- }
- break;
-
- case cFinderPrint:
- case cDragPrint:
- {
- TPDocCommand * aPDocCommand = new TPDocCommand;
- aPDocCommand->IPDocCommand(aCommandNumber, message->fMessage, reply->fMessage);
- this->PostCommand(aPDocCommand);
- }
- break;
-
- case cSectionRead:
- case cSectionWrite:
- case cSectionScroll:
- case cSectionCancel:
- {
- TSectionMgr* aSectionMgr = (TSectionMgr*) this->GetBehaviorWithIdentifier(kSectionMgrBehaviorID);
- aSectionMgr->DoAESectionEvent(aCommandNumber, message->fMessage, reply->fMessage);
- }
- break;
-
- default:
- //MDefaultScriptableObject::DoScriptCommand(aCommandNumber, message, reply);
- Inherited::DoScriptCommand(aCommandNumber, message, reply);
- break;
- }
- }
-
- //----------------------------------------------------------------------------------------
- // End of UApplication.cp
-
- #pragma segment Inline
-